<div bsModal #createAgentModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="createAgentModal" aria-hidden="true" [config]="{backdrop: 'static'}">
    <div class="modal-dialog modal-lg" *ngIf="agentApply">
        <div class="modal-content">
            <form *ngIf="active" #createAgentApplyForm="ngForm" class="horizontal-form" novalidate (ngSubmit)="save()">
                <div class="modal-header">
                    <button type="button" class="close" (click)="close()" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title">
                        <span>邀请店长</span>
                    </h4>
                </div>
                <div class="modal-body">
                    <div class="form-group row">
                        <label class="control-label col-sm-3">代理地区:</label>
                        <div class="col-sm-3">
                            <select name="province" class="form-control input-sm" id="province" (ngModelChange)="provinceChange($event)" [ngModel]="agentApply.provinceId">
                          <option [value]="province.id" *ngFor='let province of provinces.items'>{{province.name}}</option>
                        </select>
                        </div>
                        <div class="col-sm-3">
                            <select name="city" class="form-control input-sm" id="city" (ngModelChange)="cityChange($event)" [ngModel]="agentApply.cityId">
                          <option [value]="city.id" *ngFor='let city of cities.items'>{{city.name}}</option>
                        </select>
                        </div>
                        <div class="col-sm-3">
                            <select name="district" class="form-control input-sm" id="district" [(ngModel)]="agentApply.districtId">
                          <option [value]="district.id" *ngFor='let district of districts.items'>{{district.name}}</option>
                        </select>
                        </div>
                    </div>
                    <div class="form-group row">
                        <div class="col-sm-3">
                            <div class="checkbox">
                                <label>
      <input type="checkbox" name="isStudent" id="isStudent" [(ngModel)]="agentApply.isStudent" /> 是否是学生
    </label>
                            </div>
                        </div>
                        <label class="control-label col-sm-3">学校:</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control input-sm" placeholder="请输入学校名称" id="universityName" name="universityName" [(ngModel)]="agentApply.universityName" />
                        </div>
                        <div class="col-sm-3">
                            <input type="text" class="form-control input-sm" placeholder="请输入学院名称" id="collegeName" name="collegeName" [(ngModel)]="agentApply.collegeName" />
                        </div>

                    </div>
                    <div class="form-group row">
                        <label for="user" class="control-label col-sm-3">提升用户:</label>
                        <div class="col-sm-2">
                            <button (click)="showSelectUser()" type="button" class="btn btn-primary btn-sm">选择用户</button>
                        </div>
                        <div class="col-sm-7">
                            <input type="text" class="form-control input-sm" name="user" readonly [(ngModel)]="selectedUserName">
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="user" class="control-label col-sm-3">店长级别:</label>
                        <div class="col-sm-9">
                            <select name="userType" required class="form-control input-sm" id="userType" [(ngModel)]="agentApply.userType">
                            <option value="">--请选择--</option>
                          <option value="FirstAgentUser">队长</option>
                          <option value="SecondAgentUser">店员</option>
                        </select>
                        </div>
                    </div>
                    <div class="form-group row" *ngIf="agentApply.userType=='SecondAgentUser'">
                        <label for="user" class="control-label col-sm-3">选择队长:</label>
                        <div class="col-sm-9">

                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button [disabled]="saving" type="button" class="btn btn-default btn-sm" (click)="close()">取消</button>
                    <button type="submit" class="btn btn-primary blue btn-sm" [disabled]="!createAgentApplyForm.form.valid">
                      <i class="fa fa-save"></i>
                      <span>保存</span>
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>


<div class="modal fade" bsModal #userSelectModal="bs-modal" [config]="{backdrop: 'static'}" tabindex="-1" role="dialog" aria-labelledby="userSelectModal" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title pull-left">选择用户</h4>
                <button type="button" class="close pull-right" aria-label="Close" (click)="userSelectModal.hide()">
          <span aria-hidden="true">&times;</span>
        </button>
            </div>
            <div class="modal-body">
                <table class="table table-striped table-bordered table-hover table-condensed">
                    <thead>
                        <tr>
                            <td>*</td>
                            <th>姓名</th>
                            <th>手机号</th>
                            <th>注册时间</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr *ngFor="let user of userList.items">
                            <td class="thumbnail">
                                <img *ngIf="user.userAvatarId" [src]="downloadUrl+user.userAvatarId" alt="" />
                                <img *ngIf="!user.userAvatarId" src="../../../assets/app-logo-small.png" alt="" />
                            </td>
                            <td>{{user.name}}</td>
                            <td>{{user.phoneNumber}}</td>
                            <th>{{user.creationTime|date:'yyyy-MM-dd HH:mm:ss'}}</th>
                            <td>
                                <a class="btn btn-primary btn-sm" role="button" (click)="selectedUser(user)">选择</a>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>